package com.example.mapper;

import com.example.entity.User;
import org.apache.ibatis.annotations.*;

public interface UserMapper {
    @Select("select * from user where username=#{username}")
    User selectbyusername(String username);

    @Insert("insert into user (username, password, user_role) VALUES (#{username},#{password},#{userRole})")
    @Options(useGeneratedKeys = true, keyProperty = "userId")//自增主键回填
    void insert(User user);

    @Delete("delete from user where user_id=#{userId}")
    void delete(Integer userId);

    @Update("update user set username=#{username} where user_id=#{userId}")
    void update(User user);
}
